# Maintainer: David Runge <dvzrv@archlinux.org>

_name=click-help-colors
pkgname=python-click-help-colors
pkgver=0.9.1
pkgrel=4
pkgdesc="Colorization of help messages in Click"
arch=('any')
url="https://github.com/click-contrib/click-help-colors"
license=('MIT')
depends=('python-click')
makedepends=('python-setuptools')
checkdepends=('python-pytest')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz")
sha512sums=('714c464a4c13233fe0fbb776d75516b3755be57f85dae5baa04b4c99ff50b406ea9895fdc6f574504ff83a72cb16c0d63e3300ac4bb970e931fef024d617c811')
b2sums=('80b02f00cbda928b6efe4cdb540d6400d43ae000288bd967316198ef8bceec78f686bf7012b932f6c1c9a35775824a0995afdd638d3f9281e3a0cdcfca1cb8ae')

prepare() {
  mv -v "${_name}-$pkgver" "$pkgname-$pkgver"
}

build() {
  cd "$pkgname-$pkgver"
  python setup.py build
}

check() {
  cd "$pkgname-$pkgver"
  export PYTHONPATH="build:${PYTHONPATH}"
  pytest -v
}

package() {
  cd "$pkgname-$pkgver"
  python setup.py install --skip-build \
                          --optimize=1 \
                          --root="${pkgdir}"
  install -vDm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -vDm 644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -vDm 644 examples/*.py \
    -t "${pkgdir}/usr/share/doc/${pkgname}/examples"
}
